home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / text / edit / Smartindent.lha / Smartindent / Source / smartindent.h < prev    next >
C/C++ Source or Header  |  1997-12-14  |  4KB  |  140 lines

  1. /*(( "Kopf" */
  2. /* -----------------------------------------------------------------------------
  3.  
  4.    $Id: smartindent.h,v 1.7 1997/07/17 00:24:10 mshopf Exp mshopf $
  5.  
  6.    GoldED API client, ©1997 Matthias Hopf.
  7.    Compiled with SasC.
  8.  
  9.  
  10.    Smartindent Library base and Client extension.
  11.  
  12.    ------------------------------------------------------------------------------
  13. */
  14.  
  15. /*)) */
  16. #ifndef _SMARTINDENTBASE_H
  17. #define _SMARTINDENTBASE_H
  18.  
  19. /*(( "Includes" */
  20. #include <exec/libraries.h>
  21.  
  22. #include "api.h"
  23. #include "golded.h"
  24.  
  25. #define strcasecmp stricmp /* Grmbl. strange SAS/C naming */
  26.  
  27. /*)) */
  28. /*(( "Version" */
  29.  
  30. #define LIBNAME    "smartindent.api"
  31.  
  32. #define VERSION    37
  33. #define REVISION   6
  34. #define REVSTRING  "37.6"
  35. #define REVSTATE   "[beta] "
  36. #define REVDATE    __AMIGADATE__
  37.  
  38. #define LIBID      LIBNAME " " REVSTRING " " REVDATE "\0$VER: " LIBNAME " " REVSTRING " " REVSTATE REVDATE
  39.  
  40.  
  41. /*)) */
  42. /*(( "Constants" */
  43.  
  44. #ifndef RC_OK
  45. #  define RC_OK 0
  46. #endif
  47. #ifndef RC_WARN
  48. #  define RC_WARN 5
  49. #endif
  50.  
  51. /* Return codes of IsWord functions */
  52. #define MATCH_FALSE            0    /* Not a word of the language */
  53. #define MATCH_TRUE             1    /* Word of language */
  54. #define MATCH_EXACT            2    /* Word of language, longer words do not exist (speedup) */
  55.  
  56. #define MAX_WORD_LEN           20   /* Maximum length of reserved words (+1) */
  57. #define MAX_ERR_LEN            80   /* Maximum length of formated errors */
  58.  
  59. /*)) */
  60. /*(( "Structures" */
  61.  
  62. struct SmartindentBase
  63. {
  64.     struct APIBase         API;
  65.     APTR                   SegList;
  66. };
  67.  
  68. struct SmartOrder
  69. {
  70.     /* !!!It is absolutely necessary that Order is the very first element!!! */
  71.     struct APIOrder         Order;
  72.     struct APIModifyRequest Modify;
  73.     int                     StringSize; /* Maximum size of the attached string */
  74.     /* The string is attached immedeately. */
  75. };
  76.  
  77. /* Our configuration */
  78.  
  79. struct SmartConfig {
  80.     short Block_Level;                  /* bla; \n { \n -> bla; */
  81.     short Brace_Level;                  /* bla; \n -> { */
  82.     short Label_Level;                  /* -> bla: */
  83.     short Cont_Level;                   /* void \n -> bla (); */
  84.     short NextLine_Level;               /* bla = \n -> 0; */
  85.     short Comment_Level;                /* \n -> // bla */
  86.     short LineComment_Abs;              /* foo; -> // bla */
  87. } ;
  88.  
  89. struct SmartClient;
  90.  
  91. struct Semantic
  92. {
  93.     char   *Name;
  94.     char   *Descr;
  95.     char   *Version;
  96.     int    (*IsWord)   (struct SmartClient *c, char *buf, int len, int maxlen);
  97.     void   (*KeyPress) (struct SmartClient *c, int key);
  98.     void   (*Indent)   (struct SmartClient *c);
  99.     struct SmartConfig StartConf;
  100. };
  101.  
  102. struct SmartClient
  103. {
  104.     struct APIClient       API;
  105.     struct APIMessage     *Msg;
  106.     struct EditConfig     *Edit;
  107.     struct Semantic       *Sem;
  108.     struct SmartConfig     Conf;
  109.  
  110.     /* The following entries are nulled at the begining of each request. */
  111.     /* !!!It is absolutely necessary that FirstLine is the very first element!!! */
  112.  
  113.     int    FirstLine;                   /* First scanned line */
  114.     int    BeginIndent, EndIndent;      /* First, last indented line */
  115.     int    Mode;
  116.     char   *ErrTxt;
  117.  
  118.     int    CurrentLine, CurrentPos;     /* Current position, reflecting any intendations */
  119.     int    Indent, BlockIndent;         /* Current indentation level, standard and for blocks (override) */
  120.  
  121.     int    CursorX;                     /* (New) Cursor position */
  122.     int    BlockStartX, BlockEndX;      /* (New) Block position */
  123.     struct LineNode *Node;              /* Current node */
  124.     int    NextPos;                     /* Next pos to scan (node position) (== -1: continue with next line) */
  125.     int    LastPos;                     /* Last scanned position (=-1: Last Line) */
  126.     int    NextPosEOL;                  /* Next pos, used for EOF detection (may be changed) */
  127.     struct SmartOrder *Req;             /* Current APIOrder */
  128.  
  129.     char   PeekBuffer [MAX_WORD_LEN];   /* Peek buffer */
  130.     char   WordBuffer [MAX_WORD_LEN];   /* Get buffer */
  131.     char   ErrBuffer  [MAX_ERR_LEN];    /* Default Error Buffer */
  132. };
  133.  
  134. typedef struct SmartClient sc_t;
  135.  
  136. /*)) */
  137.  
  138. #endif /* _SMARTINDENTBASE_H */
  139.  
  140.